# -*- coding:utf-8 -*-
# @Author: shenyuyu
# @Time: 2023/6/13 9:34
# @File: student_manager.py

"""
学生管理系统
"""

students = []

while 1 == 1:
    print("------欢迎来到学生管理系统------")
    print("------1.添加学生--------------")
    print("------2.删除学生--------------")
    print("------3.修改学生--------------")
    print("------4.查询学生--------------")
    print("------5.显示所有学生-----------")
    print("------6.退出系统--------------")
    a = int(input("请输入需求编号："))
    if a == 1:
        student = {}
        student["name"] = input("请输入学生姓名：")
        student["sex"] = input("请输入学生性别：")
        student["age"] = input("请输入学生年龄：")
        students.append(student)
        print("添加成功！")
    elif a == 2:
        name = input("请输入要删除学生的姓名：")
        for i in students:
            if i.get("name") == name:
                students.remove(i)
                print("删除成功！")
    elif a == 3:
        name = input("请输入要修改学生的姓名：")
        for i in students:
            if i.get("name") == name:
                i["name"] = input("请输入学生姓名：")
                i["sex"] = input("请输入学生性别：")
                i["age"] = input("请输入学生年龄：")
                print("修改成功！")
    elif a == 4:
        name = input("请输入要查询学生的姓名：")
        for i in students:
            if i.get("name") == name:
                print(i)
    elif a == 5:
        print(students)
    else:
        break